]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix regressions in the item displays
authorMarina Zhurakhinskaya <marinaz@redhat.com>
Thu, 1 Oct 2009 21:41:17 +0000 (17:41 -0400)
committerMarina Zhurakhinskaya <marinaz@redhat.com>
Thu, 1 Oct 2009 21:41:17 +0000 (17:41 -0400)
Fix displaying documents in the document browse and refreshing the selection
when the results have changed.

Make sure we are passing the appropriate flag to _redisplay() in GenericDisplay.

Make sure we set this._appsStale to true if there was a change in the
applications set.

Don't call _refreshCache() from the AppDisplay constructor.

Don't short-circuit the call to _refreshCache() from _redisplay() on initial load.

Rename _redisplayFull() to recreateDisplayItems() and remove adding an
actor to the actual result list in _addDisplayItem() because we redo adding the
actors to the list in _redisplayReordering() anyway to ensure that we add
them in the right order.

Based on a patch from Colin Walters.

js/ui/appDisplay.js
js/ui/docDisplay.js
js/ui/genericDisplay.js

index 206cb79a459f390ad41212b1f97f8adad7cc1fa6..3ced5463384c3b248e48efad015979450d714bdc 100644 (file)
@@ -186,23 +186,21 @@ AppDisplay.prototype = {
         this._appsStale = true;
         this._appSystem.connect('installed-changed', Lang.bind(this, function(appSys) {
             this._appsStale = true;
-            this._redisplay(0);
-            this._redisplayMenus();
+            this._redisplay(GenericDisplay.RedisplayFlags.NONE);
         }));
         this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
-            this._redisplay(0);
+            this._appsStale = true;
+            this._redisplay(GenericDisplay.RedisplayFlags.NONE);
         }));
         this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
-            this._redisplay(0);
+            this._appsStale = true;
+            this._redisplay(GenericDisplay.RedisplayFlags.NONE);
         }));
         this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
-            this._redisplay(0);
+            this._appsStale = true;
+            this._redisplay(GenericDisplay.RedisplayFlags.NONE);
         }));
 
-        // Load the apps now so it doesn't slow down the first
-        // transition into the Overview
-        this._refreshCache();
-
         this._focusInMenus = true;
         this._activeMenuIndex = -1;
         this._activeMenu = null;
@@ -210,7 +208,6 @@ AppDisplay.prototype = {
         this._menuDisplay = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
                                           spacing: MENU_SPACING
                                        });
-        this._redisplayMenus();
 
         this.connect('expanded', Lang.bind(this, function (self) {
             this._filterReset();
@@ -303,7 +300,7 @@ AppDisplay.prototype = {
                     this._activeMenuApps = this._appSystem.get_applications_for_menu(id);
                 }
             }
-            this._redisplay(true);
+            this._redisplay(GenericDisplay.RedisplayFlags.FULL);
         }));
         this._menuDisplay.append(display.actor, 0);
     },
@@ -361,6 +358,7 @@ AppDisplay.prototype = {
                     this._addApp(app);
                 }
             }
+            this._redisplayMenus();
         }
 
         this._appsStale = false;
index 74e2c3d8bcc2ae79c2f077457c84f42ba1ce3535..87c7bf4aae4e44a4571466dbf10c881b69dc8235 100644 (file)
@@ -136,7 +136,7 @@ DocDisplay.prototype = {
             // but redisplaying right away is cool when we use Zephyr.
             // Also, we might be displaying remote documents, like Google Docs, in the future
             // which might be edited by someone else.
-            this._redisplay(false);
+            this._redisplay(GenericDisplay.RedisplayFlags.NONE);
         }));
 
         this.connect('destroy', Lang.bind(this, function (o) {
index 2ca7c558699dd44c292c5957aef53dc501464a8f..e15df20a47ab0f53d9ff178970f0ddbd832c716a 100644 (file)
@@ -486,15 +486,16 @@ GenericDisplay.prototype = {
 
     //// Protected methods ////
 
-    _redisplayFull: function() {
+    _recreateDisplayItems: function() {
         this._removeAllDisplayItems();
+        this._setDefaultList();
         for (let itemId in this._allItems) {
             this._addDisplayItem(itemId);
         }
     },
 
     // Creates a display item based on the information associated with itemId
-    // and adds it to the displayed items.
+    // and adds it to the list of displayed items, but does not yet display it.
     _addDisplayItem : function(itemId) {
         if (this._displayedItems.hasOwnProperty(itemId)) {
             log("Tried adding a display item for " + itemId + ", but an item with this item id is already among displayed items.");
@@ -525,7 +526,6 @@ GenericDisplay.prototype = {
                                               this.emit('show-details', index);
                                           }
                                       }));
-        this._list.add_actor(displayItem.actor);
         this._displayedItems[itemId] = displayItem;
     },
 
@@ -635,6 +635,7 @@ GenericDisplay.prototype = {
      *  their own while the user was browsing through the result pages.
      *  SUBSEARCH - Indicates that the current _search is a superstring of the previous
      *  one, which implies we only need to re-search through previous results.
+     *  FULL - Indicates that we need refresh all displayed items.
      */
     _redisplay: function(flags) {
         let resetPage = (flags & RedisplayFlags.RESET_CONTROLS) > 0;
@@ -642,13 +643,20 @@ GenericDisplay.prototype = {
         let fullReload = (flags & RedisplayFlags.FULL) > 0;
 
         let hadSelected = this.hasSelected();
+        this.unsetSelected();
+
+        if (!this._initialLoadComplete)
+            fullReload = true;
 
-        if (!this._initialLoadComplete || !this._refreshCache())
+        if (!this._refreshCache())
             fullReload = true;
+
         if (fullReload) {
+            this._recreateDisplayItems();
             this._initialLoadComplete = true;
-            this._redisplayFull();
-        } if (isSubSearch) {
+        }
+
+        if (isSubSearch) {
             this._redisplaySubSearch();
         } else {
             this._redisplayReordering();